<?php
declare (strict_types = 1);

namespace app\superadmin\controller;

use think\facade\Db;
use think\Request;

class role
{
    //显示列表首页
    public function index(Request $request)
    {
        $user = session('user');
        if($user['group_id'] == 1){
            $data = Db::name('group')->paginate(10);

        }else{
            $data = Db::name('group')->where('id',$user['group_id'])->paginate(10);
        }

        //单独拿出分页变量
        $page = $data -> render();
        return view('',['data'=>$data,'page'=>$page]);
    }

    //显示添加页面
    public function create()
    {
        return view();
    }

    //显示编辑页面
    public function edit(Request $request)
    {
        $get = $request -> all();
        $data = Db::name('group')->find($get['id']);
        return view('',['data'=>$data]);
    }
}
